package com.lyy.controller;

import com.lyy.entity.Order;
import com.lyy.feign.ProductFeign;
import com.lyy.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Liangyaoyun
 */
@RestController
@RequestMapping("/api/v1/order")
public class OrderController {
    @Autowired
    public OrderService orderService;
    @Autowired
    public ProductFeign productFeign;
    @PostMapping("/insert")
    public int insertOrder(@RequestBody Order order){
        productFeign.updateProduct(order.getProductId(), order.getNumber());
        return orderService.insert(order);
    }

}
